package wiki.xsx.core.snowflake.config.zookeeper;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryClient;
import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryProperties;
import org.springframework.context.annotation.Configuration;
import wiki.xsx.core.snowflake.config.DiscoveryConfig;

/**
 * zookeeper配置
 * @author xsx
 * @date 2019/11/20
 * @since 1.8
 */
@Configuration("snowflakeDiscoveryConfig")
@ConditionalOnClass({
        ZookeeperDiscoveryClient.class,
        ZookeeperDiscoveryProperties.class
})
public class ZookeeperDiscoveryConfig implements DiscoveryConfig {

    @Value("${spring.application.name}")
    private String serviceName;

    /**
     * 获取服务名称
     */
    @Override
    public String getServiceName() {
        return this.serviceName;
    }
}
